<div class="categories clearfix">
    <span>Brands:</span><a href="#" rel="0" class="active">All</a>
    <?php foreach ($categories as $category): ?>
        <?php echo CHtml::link($category->name, '#', array('rel'=>$category->id)); ?>
    <?php endforeach; ?>
</div>

<?php
    Yii::app()->clientScript->registerScript('categoryFilter',
        "$('.categories a').click(function(e){
            e.preventDefault();
            $(this).addClass('active').siblings().removeClass('active');
            cate={category: $(this).attr('rel')};
            $.fn.yiiListView.update(
                'ajaxListView',
                {data: cate}
            );
        });"
    );
?>